#pragma once
#include <vector>
#include "IState.h"

/*enum directions
{
	START = 0,
	LEFT = -1,
	RIGHT = 1,
	TOP = -a,
	BOTTOM = a

};*/

enum directions
{
	START,
	LEFT,
	RIGHT,
	TOP,
	BOTTOM

};

class PuzzleState :	public IState
{
public:
	PuzzleState(int* table, int width, int height, int previousDirection, int* directionsTab, bool random, int directionsCount, int heuristic);
	~PuzzleState(void);
	

	virtual bool isSameState(IState* state);
	virtual float costDistance(IState* state);
	virtual float costHeuristic(IState* state);
	virtual bool createSuccesors(std::vector<IState*>* vectorSuccesors);

	int* getGameTable();
	bool compareTables(int* table1, int* table2);
	void copyTable(int* src, int* dst, int items);
	void swap(int* table, int index1, int index2);
	int findStartPoint(int* t, int n);

	int getPreviousDirection();

private:	
	int* gameTable;
	int width;
	int height;
	int previousDirection;

	int* directionsTab;
	int directionsCount;

	int heuristic;
	bool random;

	float heuristic1(IState* state);
	float heuristic2(IState* state);

	void randomizeDirections();
};

